<template>
  <div class="tmpl">
    <div class="mask"></div>
    <ul>
      <li v-for="address in addressList" :key="address.addressId" @click="sendAddress(address)">
        {{address.userName}}
        {{address.streetName}}
        {{address.tel}}
      </li>
    </ul>
  </div>
</template>

<script type="text/javascript">
export default{
  data(){
    return {
      addressList: [],
      toAddress: {}
    }
  },
  methods: {
    getAddressList(){
      let _this = this;
      this.$http.get('../../../statics/data/address.json').then(res=>{
        console.log(res)
        _this.addressList = res.data.data;
      })
    },
    sendAddress(address){
      this.toAddress = address;
      this.$emit('reAddress',address);
      this.$emit('maskShow')

      // var mask = document.querySelector('.mask')
      // var ul = document.querySelector('ul')
      // mask.style.display = 'none';
      // ul.style.display = 'none';
    }
  },
  created(){
    this.getAddressList()
  }
}
</script>

<style type="text/css" scoped>
  .tmpl{
    margin: 0;
  }
  .mask{
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
   /* width: 100px;
    height: 100px;*/
    z-index: 5;
    background-color: rgba(0,0,0,0.3)
  }
  ul{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9;
    background-color: #fff;
    margin-top: 0;
    margin-right: 0;
    text-align: center;
  }
  ul li{
    list-style: none;
    height: 40px;
    border: 1px solid red;
    margin-bottom: 10px;
    line-height: 40px;
    margin-left: -20px;
  }
</style>


